package com.hist.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hist.entity.AddressCheck;
import com.hist.entity.AgeCheck;
import com.hist.entity.AllScore;
import com.hist.entity.Percent;
import com.hist.entity.SpolCheck;
import com.hist.entity.Student;
import com.hist.service.AdministratorService;

@Controller
public class AdministratorController {

	   @Autowired
	   AdministratorService service;
	   /*查看全体学生信息*/
	   @ResponseBody
	   @RequestMapping("/allstudent")
	   public List<Student> allstudent()
	    {
		   return service.allstudent();
	    }
	 
       /*查看全体学生成绩*/
	   @ResponseBody
	   @RequestMapping("/allscore2")
	   public List<AllScore> allScore()
	   {
		   return service.allScore();
	   }
	   
	   /*修改学生信息*/
	   @ResponseBody
       @RequestMapping("/student") 
	   public List<Student> getStudent(Integer sno)
	   {
		   return service.getStudent(sno);
	   }
	   @ResponseBody
       @RequestMapping("/updateStudent") 
	   public void updateStudent(Integer sno,String sname,String ssex,Integer sage,String sdept,String smajor,Integer sgrade,Integer school_length,String saddress,String spol,String snation,String srp,String smove)
	    {
		     service.updateStudent(sno,sname,ssex,sage,sdept,smajor,sgrade,school_length,saddress,spol,snation,srp,smove);
		   
	    }
	   
	   /*按年龄统计人数*/
	   @ResponseBody
	   @RequestMapping("/ageCheck")   
	   public List<AgeCheck> ageCheck()
	   {
		   return service.ageCheck();
	   }
	   
	   /*按地区统计人数*/
	   @ResponseBody
	   @RequestMapping("/addressCheck")
	   
	   public List<AddressCheck> addressCheck()
	    {
		   return service.addressCheck();
	    }
	   
	   /*按政治面貌统计人数*/
	   @ResponseBody
	   @RequestMapping("/spolCheck")
	   
	   public List<SpolCheck> spolCheck()
	    {
		   return service.spolCheck();
	    }
	   
	   /*按专业年级查看学生成绩*/
	   @ResponseBody
	   @RequestMapping("/majorScore2")
	   public List<AllScore> checkScore(String smajor,Integer sgrade)
	   {
		   return service.checkScore(smajor,sgrade);
	   }
	   
	   /*按专业年级查看学生成绩百分比以及人数*/
	   @ResponseBody
	   @RequestMapping("/percent2")
	   public List<Percent> getpercent(String smajor,Integer sgrade)
	   {
		   return service.getpercent(smajor,sgrade);
	   }
	   
	   /*修改学生成绩*/
	   @ResponseBody
	   @RequestMapping("/score")
	   public List<AllScore> getScore(Integer sno)
	   {
		   return service.getScore(sno);
	   }
	   @ResponseBody
	   @RequestMapping("/updateScore")
	   public void updateScore(Double score,Integer sno)
	   {
		   service.updateScore(score, sno);
	   }
	   
	   
	  
}
